Posts

Post marked as solved
7 Replies
Sure and thanks in advance.
Post marked as solved
7 Replies
First of all, thank you very much. I came across this StackOverflow question yesterday as well but thought I did something wrong and creating my own image just didn't feel right, but if that's the solution. Still, I don't understand why the imageInsets do not work on UIImages that are initialized with an SFSymbol but do work when I use an image which is in an Assets folder.
Post marked as solved
7 Replies
E.g. the "gearshape" or "gear" symbol, they are very close to the title, whereas the "function" symbol is far away. It only seems to be a few pixels, but both next to each other look pretty bad. I would upload a picture, but I don't see a way to do that here.
Post not yet marked as solved
9 Replies
I do not want to my make my variables internal, but private so I need setters to provide my default values for different Soldies.when subclassing Soldier. I do not want to change any function in a subclass it is all about the default values and not having internal variables.So I wanna be able to write:let protArcher: SoldierProtocol = Archer()protArcher.move()but something like this should not be possible and is not with if I do it like above.protArcher.defense //Errorand if I dont use the protocol and put the functions in the Soldier class I could write this.If I dont use private + setters.let archer: Archer = Archer()archer.defenseMaybe Iam just unable to state what my problem is or it is not even one.Either way thanks.
Post not yet marked as solved
9 Replies
Thanks,suppose there is another enum Country and the default value for the Soldier depends on the SoldierType and Country,I got like 50+ possible combinations, would it be good to combine both approaches,for example like this?enum Country { GERMANY FRANCE NORWAY...}class Archer: Soldier { init(country: Country) { super.init() self.country = country type = .ARCHER switch country { case .GERMANY: healtPoints = 10 attack = 10 defense = 2 ... } }}
Post not yet marked as solved
9 Replies
Thanks,yes I meant the protected access modifier.Is there any solution without setters, here is just a little example I have in mind.protocol SoldierProtocol { func attack() func move()...}class Soldier: SoldierProtocol { var healthPoints: Int var attack: Int var defense: Int var type: SoldierType func attack { ... }...}class Archer: Soldier {init() { super.init() healtPoints = 100 attack = 10 defense = 2 type = .ARCHER }}let soldier: SoldierProtocol = Archer()...So I still have an internal initializer for the Soldier class, but if I dont use it and write a doc for it, it may be ok?Is this a valid alternative or should I go with setters ?
Post marked as solved
3 Replies
Thank you very much,the TestController deinitializer got called and I tried some other stuff and its working perfectly.Still got one more question, why is the memory usage going up?For Example my TestControllers View has some Labels and a Button, who dismisses the TestController.But despite the fact that the TestController got deinitialized, the memory usage is always going upby some MB, when I present the TestController and dismiss it again.